package com.yummy.convention.page;

import java.io.Serializable;
import java.util.Collections;
import java.util.List;

public class Pagination<T> implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -7165629883629376946L;
	private long total;
	private List<T> list;
	public long getTotal() {
		return total;
	}
	public void setTotal(long total) {
		this.total = total;
	}
	public List<T> getList() {
		return list;
	}
	public void setList(List<T> list) {
		this.list = list;
	}
	
	public static <T> Pagination<T> empty(long size) {
		Pagination<T> page = new Pagination<>();
		page.setTotal(size);
		page.setList(Collections.emptyList());
		return page;
	}
	public static <T> Pagination<T> create(long total,
			List<T> list) {
		Pagination<T> page = new Pagination<>();
		page.setTotal(total);
		page.setList(list);
		return page;
	}
	
}
